package com.example.demo.controller;
import com.example.demo.model.Dypay;
import com.example.demo.model.Log;
import com.example.demo.service.ILogService;
import com.example.demo.service.Impl.LogServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;

/**
 * @author Administrator 高欣月
 */

@Api(tags = "物业日志")
@RestController
@RequestMapping("/swagger5")
public class LogController {
    @Autowired
    private ILogService logService;
    @CrossOrigin
    @ApiOperation(value="对人员信息的添加方法")
    @PostMapping("/insertLog")
    public int insertLog(@RequestBody Log log){
        System.out.println("进入添加人员接口" );
        return logService.insertLog(log);
    }

    @PostMapping("/getAllLog")
    public List<Log> getAllLog(@RequestBody Log log)
    {
        System.out.println("进入查询方法");
        List<Log> listLog=logService.getAllLog(log);
        return listLog;
    }

    @PostMapping("/editLog")
    public int EditLog(@RequestBody Log log){
        System.out.println("添加修改方法");
        return logService.updateLog(log);
    }
    @GetMapping("/delLog")
    public int Delete(int logid){
        System.out.println("进入删除方法");
        int returnValues=0;
        if(logid!=0){
            Log log=new Log();
            log.setLogid(logid);
            returnValues=logService.deleteLog(log);
        }
        return returnValues;
    }

    @GetMapping("/getLog")
    public Log getLog(int logid){
        Log log=new Log();
        System.out.println("进入单条查询方法");
        if(logid!=0){
            Log log1=new Log();
            log1.setLogid(logid);
            log=logService.getLog(log1);
            System.out.println("返回的数据集合为:"+log.getLogid());
        }
        return log;
    }
}

